﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Windows.Data;

namespace TestGWApp.Converter
{
    public class DuartionConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int time = (int)value;

            int second = time % 60;    //计算秒
            time /= 60;
            int minute = time % 60;     //计算分
            time /= 60;
            int hour = time % 60;   //计算时
            time /= 60;
            int day = time % 24;    //计算天

            return $"{day}天 {hour}:{minute}:{second}";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
